//index.js
const config = require('../../common/config');
const app = getApp()

Page({
  data: {
      allTypes : []
  },
  onLoad:function () {
      wx.setNavigationBarTitle({
          title: '所有分类'
      })
      var _this = this;

      wx.showLoading({
          title: '加载中..',
          icon: 'loading',
          duration: config.TIME_OUT,
          mask:true
      })
      wx.request({
          url: config.COMMPT_REQPATH,
          header: {
              "Content-Type": "application/x-www-form-urlencoded"
          },
          method:'POST',
          data: {
              accessToken: '',
              refreshToken: '',
              serviceName: 'dmService',
              methodName: 'getProductTypeTree',
              reqData:''
          },
          success: function (res) {
              var resultData = res.data.rows;
              _this.setData({
                  allTypes:resultData
              })
          },
          complete:function () {
              wx.hideLoading();
          }
      })

  }
})
